<template>
  <div id="auth_ok">
    <div class="wrapper">
      <div class="back_part">
        <div class="back_btn" @click="goBack">
          <img src="@/assets/images/pc_black/auth/back.png" />
          <span>返回</span>
        </div>
      </div>

      <div class="discribe_part">
        <span>实名认证</span>
        <span
          >按照法律法规要求，进一步使用区块链服务需要提供身份信息，请填写真实、有效的信息。</span
        >
        <span
          >实名认证后即可创建区块链地址并支付购买，请确认注册手机号与实名信息匹配。</span
        >
      </div>

      <div class="logo_part">
        <div class="logo_box">
          <img src="@/assets/images/pc_black/center/auth_ok_big.png" />
          <span>您的身份已认证</span>
        </div>
      </div>

      <div class="form_part">
        <div class="form_box">
          <label>
            <span>真实姓名</span>
            <input
              class="nameInput"
              v-model.trim="formData.realName"
              type="text"
              readonly
            />
          </label>
          <label>
            <span>身份证号</span>
            <input
              class="idInput"
              v-model.trim="formData.IDCard"
              :type="IDCard_type"
              readonly
            />
            <img
              v-if="IDCard_type === 'password'"
              src="@/assets/images/pc_black/center/password_close.png"
              @click="changeType('text')"
            />
            <img
              v-else
              src="@/assets/images/pc_black/center/password_open.png"
              @click="changeType('password')"
            />
          </label>
        </div>

        <div class="btn_box">
          <button class="btn_grey" :disabled="cantBtn">
            已认证
          </button>
        </div>
      </div>

      <!-- <div class="bottom_part">
        <div class="font_box">
          <span
            >Copyright © 2022 海南原上区块链科技有限公司 All Rights Reserved.
          </span>
          <span>琼ICP备18003326号-3</span>
        </div>
      </div> -->
    </div>
  </div>
</template>

<script>
// vuex
import { mapState, mapActions } from "vuex";

export default {
  name: "AuthOK",
  data() {
    return {
      // form data
      formData: {
        realName: "",
        IDCard: "",
      },
      // btn disabled
      cantBtn: true,
      // idcard type
      IDCard_type: "password",
    };
  },
  computed: {
    // ------ vuex ------
    ...mapState(["userInfo"]),
  },
  created() {
    this.getUserInfo();
  },
  mounted() {
    this.formData.realName = this.userInfo.realname;
    this.formData.IDCard = this.userInfo.idcard;
  },
  methods: {
    // ------ vuex ------
    // 获取用户信息（用于认证之后更新vuex里的userInfo数据）
    ...mapActions(["getUserInfo"]),

    // ------ common ------
    // 切换显示类型
    changeType(type) {
      this.IDCard_type = type;
    },

    // ------ gotoPage ------
    // 回退
    goBack() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="less" scoped>
#auth_ok {
  position: absolute;
  left: 0;
  right: 0;
  top: 60px;
  bottom: 0;
  background: #171818;

  .wrapper {
    width: 1200px;
    margin: 0 auto;
  }

  // >> 返回按钮部分
  .back_part {
    width: 100%;
    padding-top: 20px;

    .back_btn {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 104px;
      height: 30px;
      border: none;
      background: none;
      background-image: url("../../assets/images/personalCenter/btn.png");
      background-position: center center;
      background-size: 100% 100%;
      cursor: pointer;

      img {
        width: 20px;
        height: 6px;
      }

      span {
        font-size: 12px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #ffffff;
        line-height: 12px;
        margin-left: 10px;
      }
    }
  }

  // >> 描述信息部分
  .discribe_part {
    display: flex;
    flex-direction: column;
    padding-top: 30px;

    span {
      font-family: PingFangSC-Regular, PingFang SC;
      color: #999999;
      font-weight: 400;
      font-size: 14px;
      line-height: 14px;
    }

    span:nth-child(1) {
      font-family: PingFangSC-Semibold, PingFang SC;
      font-size: 18px;
      font-weight: 600;
      color: #ffffff;
      line-height: 18px;
    }

    span:nth-child(2) {
      margin: 20px 0 15px 0;
    }
  }

  // >> logo部分
  .logo_part {
    padding-top: 40px;

    .logo_box {
      display: flex;
      width: 126px;
      flex-direction: column;
      align-items: center;

      img {
        width: 60px;
        height: 60px;
      }

      span {
        font-size: 18px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #ffffff;
        line-height: 18px;
        margin-top: 20px;
      }
    }
  }

  // >> 表单部分
  .form_part {
    padding-top: 30px;

    .form_box {
      position: relative;
      display: flex;
      flex-direction: column;

      label {
        display: flex;
        align-items: center;
        height: 42px;
        padding: 0;
        margin: 0;

        span {
          font-size: 16px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #ffffff;
          line-height: 16px;
        }

        input {
          width: 300px;
          height: 42px;
          background: #1e2020;
          border: 1px solid #444444;
          padding-left: 10px;
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #ffffff;
          line-height: 14px;
          margin-left: 23px;
        }
        input::-webkit-input-placeholder {
          /* WebKit browsers 适配谷歌 */
          color: #555555 !important;
        }
        input:-moz-placeholder {
          /* Mozilla Firefox 4 to 18 适配火狐 */
          color: #555555 !important;
        }
        input::-moz-placeholder {
          /* Mozilla Firefox 19+ 适配火狐 */
          color: #555555 !important;
        }
        input:-ms-input-placeholder {
          /* Internet Explorer 10+  适配ie*/
          color: #555555 !important;
        }
      }

      label:nth-child(2) {
        margin-top: 15px;
      }

      img {
        position: absolute;
        left: 348px;
        width: 19px;
        height: 14px;
        z-index: 999;
        cursor: pointer;
      }
    }

    .btn_box {
      padding-top: 30px;
      padding-left: 87px;

      button {
        width: 215px;
        height: 39px;
        border: none;
        background: none;
        background-size: 100% 100%;
        background-position: center center;
        font-size: 14px;
        font-family: PingFangSC-Semibold, PingFang SC;
        font-weight: 600;
        color: #1e2020;
        line-height: 14px;
      }
      .btn_color {
        background-image: url("../../assets/images/pc_black/auth/btn_color.png");
      }
      .btn_grey {
        background-image: url("../../assets/images/pc_black/auth/btn_grey.png");
      }
    }
  }

  // >> 底部部分
  .bottom_part {
    position: absolute;
    bottom: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 122px;
    background: #171818;
    box-shadow: 0px -1px 0px 0px #2e2f2f;

    .font_box {
      display: flex;
      flex-direction: column;

      span {
        font-size: 14px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #999999;
        line-height: 14px;
        text-align: center;
      }

      span:nth-child(2) {
        margin-top: 15px;
      }
    }
  }
}
</style>
